/**
 * MineAdmin is committed to providing solutions for quickly building web applications
 * Please view the LICENSE file that was distributed with this source code,
 * For the full copyright and license information.
 * Thank you very much for using MineAdmin.
 *
 * @Author X.Mo<root@imoi.cn>
 * @Link   https://github.com/mineadmin
 */
import type { MaFormItem } from "@mineadmin/form";
import hasAuth from "@/utils/permission/hasAuth.ts";
import MaDictRadio from "@/components/ma-dict-picker/ma-dict-radio.vue";
import MaDictSelect from "@/components/ma-dict-picker/ma-dict-select.vue";
import { concat } from "lodash-es";

export default function getFormItems(
  formType: "add" | "edit" = "add",
  t: any,
  model: any
): MaFormItem[] {
  return concat([
    {
      label: "设备名称",
      prop: "device_name",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "设备名称" }) },
    },
    {
      label: "设备型号",
      prop: "device_model",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "设备型号" }) },
    },
    {
      label: "设备品牌",
      prop: "device_brand",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "设备品牌" }) },
    },
    {
      label: "设备序列号",
      prop: "device_sn",
      render: "input",
      renderProps: {
        placeholder: t("form.pleaseInput", { msg: "设备序列号" }),
      },
    },
    {
      label: "经度",
      prop: "longitude",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "经度" }) },
    },
    {
      label: "纬度",
      prop: "latitude",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "纬度" }) },
    },
    {
      label: "海拔高度",
      prop: "altitude",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "海拔高度" }) },
    },
    {
      label: "IP地址",
      prop: "ip_address",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "IP地址" }) },
    },
    {
      label: "端口号",
      prop: "port",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "端口号" }) },
    },
    {
      label: "密钥",
      prop: "secret",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "密钥" }) },
    },
    {
      label: "MAC地址",
      prop: "mac_address",
      render: "input",
      renderProps: { placeholder: t("form.pleaseInput", { msg: "MAC地址" }) },
    },
    // {
    //   label: "最后在线时间",
    //   prop: "last_online_time",
    //   render: "DatePicker",
    //   renderProps: {
    //     placeholder: t("form.pleaseInput", { msg: "最后在线时间" }),
    //     format: "YYYY-MM-DD",
    //     valueFormat: "YYYY-MM-DD",
    //   },
    //   mode: "date",
    //   showTime: true,
    // },
    {
      label: "维护状态",
      prop: "maintenance_status",
      render: () => MaDictSelect,
      renderProps: {
        data: [
          { label: "正常", value: 1 },
          { label: "需要维护", value: 2 },
          { label: "维护中", value: 3 },
          { label: "报废", value: 4 },
        ],
        placeholder: t("form.pleaseInput", { msg: "维护状态" }),
        clearable: true,
        multiple: false,
      },
      itemProps: {
        rules: [
          {
            required: true,
            message: "请选择维护状态",
          },
        ],
      },
    },
  ]);
}
